-
Notifications
You must be signed in to change notification settings - Fork 70
Agents on Apps: langgraph long term agent memory example #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agents on Apps: langgraph long term agent memory example #86
Conversation
bbqiu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR looks awesome! left a few small nits, thank you for working on this!
| # Check if LAKEBASE_INSTANCE_NAME already exists in app.yaml | ||
| if grep -q "name: LAKEBASE_INSTANCE_NAME" app.yaml; then | ||
| echo "LAKEBASE_INSTANCE_NAME already exists in app.yaml, skipping Lakebase setup..." | ||
| # Extract the existing value from app.yaml for display in summary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this? since app.yaml has valueFrom database instead of a real string value
can also make this an input param to match what sid also is working on making the quickstart command require less user input (so AI can run it fully): https://github.com/databricks/app-templates/pull/82/files#diff-0634e5169824dfbd324f2962bb69f68e1dd4445e4ee953cbe74b04e1ca9b8329
| fi | ||
| echo "✓ Lakebase instance name saved to .env.local" | ||
|
|
||
| echo "Adding LAKEBASE_INSTANCE_NAME to app.yaml..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to replace the app.yaml value here?
| echo "✓ Configuration files created (.env.local)" | ||
| echo "✓ MLflow experiment created: $EXPERIMENT_NAME" | ||
| echo "✓ Experiment ID: $EXPERIMENT_ID" | ||
| echo "✓ Configuration updated in .env.local" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we add a line here for the lakebase instance name
| 1. **Set up authentication to Databricks resources** | ||
| For this example, you need to add an MLflow Experiment and Lakebase instance as a resource to your app. Grant the App's Service Principal (SP) permission to edit the experiment by clicking `edit` on your app home page. See the [Databricks Apps MLflow experiment documentation](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/mlflow) for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we add link to database docs
| ``` | ||
| 3. **Grant Lakebase permissions to your App's Service Principal** | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we explain what's going on here? where connect + create doesn't grant perms for previously created schemas etc.
| ############################################ | ||
| # Memory tools | ||
| ############################################ | ||
| def memory_tools(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we name it init_memory_tools to make it clear that this is to create them
Added long term memory/retrieval features to our agent langgraph as a stateful agent example
Note: frontend e2e-chatbot-app interface does not support passing in custom input/thread id, only invocation calls on the endpoint. Have filed a ticket to support passing in chatcontext via frontend interface so we can use user id for namespacing
example app: https://eng-ml-agent-platform.staging.cloud.databricks.com/apps/j-longtermagent?o=2850744067564480
Example local testing:
output from above:
Follow-up:
Output:
seeing store tables are ready in app logs:

ensure user preferences are stored in lakebase:

Currently, cannot use long-term memory via frontend because user id is not passed in to context. Also made sure you cannot access another user's memories via frontend
App postman request:
